package com.ruoyi.car.service.impl;

import java.util.List;

import com.ruoyi.car.vo.RecordAndListAndUseAndUserAndDeptVO;
import com.ruoyi.car.vo.RecordAndListAndUseVO;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.car.mapper.TmdCarRecordMapper;
import com.ruoyi.car.domain.TmdCarRecord;
import com.ruoyi.car.service.ITmdCarRecordService;
import com.ruoyi.common.core.text.Convert;

/**
 * 用车记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-04-26
 */
@Service
public class TmdCarRecordServiceImpl implements ITmdCarRecordService 
{
    @Autowired
    private TmdCarRecordMapper tmdCarRecordMapper;

    /**
     * 查询用车记录
     * 
     * @param id 用车记录主键
     * @return 用车记录
     */
    @Override
    public RecordAndListAndUseAndUserAndDeptVO selectTmdCarRecordById(Long id)
    {
        return tmdCarRecordMapper.selectTmdCarRecordById(id);
    }

    /**
     * 查询用车记录列表
     * 
     * @param tmdCarRecord 用车记录
     * @return 用车记录
     */
    @Override
    public List<RecordAndListAndUseVO> selectTmdCarRecordList(RecordAndListAndUseVO tmdCarRecord)
    {
        List<RecordAndListAndUseVO> recordAndListAndUseVOS = tmdCarRecordMapper.selectTmdCarRecordList(tmdCarRecord);
        System.out.println(recordAndListAndUseVOS);
        return recordAndListAndUseVOS;
    }

    /**
     * 新增用车记录
     * 
     * @param tmdCarRecord 用车记录
     * @return 结果
     */
    @Override
    public int insertTmdCarRecord(TmdCarRecord tmdCarRecord)
    {
        tmdCarRecord.setCreateTime(DateUtils.getNowDate());
        return tmdCarRecordMapper.insertTmdCarRecord(tmdCarRecord);
    }

    /**
     * 修改用车记录
     * 
     * @param tmdCarRecord 用车记录
     * @return 结果
     */
    @Override
    public int updateTmdCarRecord(TmdCarRecord tmdCarRecord)
    {
        return tmdCarRecordMapper.updateTmdCarRecord(tmdCarRecord);
    }

    /**
     * 批量删除用车记录
     * 
     * @param ids 需要删除的用车记录主键
     * @return 结果
     */
    @Override
    public int deleteTmdCarRecordByIds(String ids)
    {
        return tmdCarRecordMapper.deleteTmdCarRecordByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除用车记录信息
     * 
     * @param id 用车记录主键
     * @return 结果
     */
    @Override
    public int deleteTmdCarRecordById(Long id)
    {
        return tmdCarRecordMapper.deleteTmdCarRecordById(id);
    }
}
